import requests
import json

def call_api(instruction_content):
    # 设置API的URL
    url = "http://10.119.130.188:6008"  # 确保这是正确的URL

    # 设置请求的数据
    data = {"prompt": instruction_content}

    headers = {'Content-Type': 'application/json'}
    # 发送POST请求
    response = requests.post(url, headers=headers, data=json.dumps(data))

    # 检查响应状态码
    if response.status_code == 200:
        # 解析响应内容
        result = response.json()
        print("Response:", result["response"])
        return response.json()['response']
    else:
        print("Failed to retrieve data:", response.status_code)

    return "Error"




# call_api('什么是机器学习？')
